<template>
	<!-- 头部 -->
	<div id="web_head">
		<div id="work_top">
			<div class="logo">
				<navigator url="/" hover-class="none">
					<img class="top_pic" src="../../static/images/top1.png" alt="">
				</navigator>
			</div>
			<div class="operate">
				<div class="right_function">
					<span>admin 你好，欢迎回来！</span>
					<span>
						<a href="javascript:;">
							<img src="../../static/images/top2.png" alt="">
						</a>
					</span>
					<span class="sign_out">
						<a href="javascript:;" @click="OutLogin()">
							<img src="../../static/images/top3.png" alt="" title="退出">
						</a>
					</span>
				</div>
			</div>
		</div>
	</div>
	<!-- 头部 end -->
</template>

<script>
	export default {
		name: 'Header',
		data() {
			return {

			}
		},
		props: ['cur'],
		mounted() {
			let that = this;
			if (that.common.GetStorage('bytoken')) {

			} else {
				uni.reLaunch({
					url: '/pages/index/login',
				})
			}
		},
		created() {

		},
		methods: {
			OutLogin: function() {
				let that = this;
				that.$confirm('确定要退出登录吗?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					uni.showToast({
						icon: 'none',
						title: '退出成功',
						duration: 2000
					});
					uni.removeStorage({
						key: 'bytoken',
						success: function(res) {
							console.log('success');
						}
					});					
					setTimeout(function() {
						uni.reLaunch({
							url: '/pages/index/login',
						})
					}, 1500);
				}).catch(() => {

				});
			},
		}
	}
</script>